import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

public class UdpDictSever extends UdpEchoSever{
    private HashMap<String,String> dict = new HashMap<>();

    public UdpDictSever(int port) throws SocketException {
        super(port);
        dict.put("cat","小猫");
        dict.put("dog","小狗");
    }
    @Override
    public String process(String request) {
       return dict.getOrDefault(request,"该词无法被翻译");
    }

    public static void main(String[] args) throws IOException {
        UdpDictSever sever = new UdpDictSever(8080);
        sever.start();
    }
}
